<template>
  <div>
    <h2>我是孙组件</h2>
    <p>title:{{ title }}</p>
    <p>age:{{ $attrs.age }}</p>
    <button @click="handClick">改变age</button>
  </div>
</template>

<script>
export default {
  name: 'Child-2',
  props: ['title'],
  methods: {
    handClick() {
      // this.$emit('changAge', this.$attrs.age + 1)
      this.$listeners.changAge(this.$attrs.age + 1)
    }
  },
  mounted() {
    console.log('孙子组件$attrs:', this.$attrs)
    console.log('孙子组件$listeners:', this.$listeners)
  }
}
</script>
